<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>Hello APP</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <script src="../../script/vue.min.js"></script>
    <script src="../../script/fastclick.js"></script>
	<style>

	</style>
</head>
<body>

</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript">
    apiready = function(){
      FastClick.attach(document.body);
		var ver = api.version;
		var sType = api.systemType;
		var sVer = api.systemVersion;
		var id = api.deviceId;
		var model = api.deviceModel;
		var name = api.deviceName;
		var cType = api.connectionType;
		var winName = api.winName;
		var winWidth = api.winWidth;
		var winHeight = api.winHeight;
		var frameName = api.frameName || '';
		var frameWidth = api.frameWidth || '';
		var frameHeight = api.frameHeight || '';

		var dome = $api.byId('zhifu')
		var map = api.require('bMap');
		var bMap = api.require('bMap');
		$api.addEvt(dome, 'click', function(){
			bMap.getLocation({
			    accuracy: '100m',
			    autoStop: true,
			    filter: 1
			}, function(ret, err) {
			    if (ret.status) {
			        open(ret.lon, ret.lat);
			    } else {
			        alert(err.code);
			    }
			});
		});

		function open (lon, lat) {
			map.open({
			    rect: {
			        x: 0,
			        y: 0,
			        w: winWidth,
			        h: frameHeight
			    },
			    center: {
			        lon: lon,
			        lat: lat
			    },
			    zoomLevel: 18,
			    showUserLocation: true,
			    fixedOn: api.frameName,
			    fixed: true
			}, function(ret) {
			    if (ret.status) {
			        api.alert({
					    title: '提示',
					    msg: '打开',
					}, function(ret, err) {

					});
			    }
			});
		}

		var other = $api.byId('pay')
		$api.addEvt(other, 'click', function(){
			api.openWin({
    			name: 'other',
    			url: 'other.html',
    			pageParam: {
    			    name: 'test'
    			},
    			animation: {
    				type:"movein",
    				subType:"from_right",
    				duration:300
    			}
			});
		})
    };
</script>
</html>
